package cn.lili.modules.promotion.client;

import cn.lili.modules.constant.ServiceConstant;
import cn.lili.modules.order.order.entity.vo.UnionMonthFundsVO;
import cn.lili.modules.order.order.entity.vo.UnionOrderParams;
import cn.lili.modules.promotion.entity.dos.GreenContributionInfo;
import cn.lili.modules.promotion.entity.dto.GreenConfigValueDTO;
import cn.lili.modules.promotion.fallback.GreenFallback;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @author xiangqian
 * @version 1.0
 * @data 2023/12/21 15:57
 */
@FeignClient(path = "${server.servlet.context-path}", name = ServiceConstant.PROMOTION_SERVICE, contextId = "green-activity", fallback = GreenFallback.class)
public interface GreenClient {

    /**
     * 计算单价
     *
     * @return 返回结果
     */
    @GetMapping("/feign/promotion/green-activity/initGreenUnitPrice")
    Boolean initGreenUnitPrice();

    /**
     * 添加待结算贡献值/绿色积分
     *
     * @param greenContributionInfo 添加数据{@link GreenContributionInfo}
     * @return 返回结果
     */
    @PutMapping("/feign/promotion/green-activity/saveSettle")
    Boolean saveSettle(@RequestBody GreenContributionInfo greenContributionInfo);


    /**
     * 查询最新功能配置
     */
    @GetMapping("/feign/promotion/green-activity/getNewGreenConfigValueDTO")
    GreenConfigValueDTO getNewGreenConfigValueDTO();

    /**
     * 添加结算贡献值/绿色积分
     *
     * @param orderSn 子订单ID
     * @return 返回结果
     */
    @GetMapping("/feign/promotion/green-activity/settle")
    Boolean settle(@RequestParam("orderSn") String orderSn, @RequestParam("userId") String userId);

    /**
     * 修改状态为直接打款/取消订单
     *
     * @param orderSn 订单号
     * @param userId  用户ID
     * @param status  状态
     */
    @GetMapping("/feign/promotion/green-activity/settleDirect")
    Boolean settleDirect(@RequestParam("orderSn") String orderSn, @RequestParam("userId") String userId, @RequestParam("status") String status);

    @PostMapping("/feign/promotion/green-activity/getGreenContributionInfo")
    GreenContributionInfo getGreenContributionInfo(@RequestBody GreenContributionInfo greenContributionInfo);

    @PostMapping("/feign/promotion/green-activity/getSumContributeSettleByUnion")
    Page<UnionMonthFundsVO> getSumContributeSettleByUnion(@RequestBody UnionOrderParams params);
}
